<%@ CodePage = 65001 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Stamp Poll</title>
</head>
<body>
<!-- #include file="adovbs.inc" -->
<%

dim strSQL,dateStr

'Connect database
set conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
'Remote host connection.
conn.Open(Server.MapPath("/")+"\..\database\stamppoll.mdb")
'Local host connection.
'conn.Open(Server.MapPath("\database\stamppoll.mdb"))

'Insert record
dateStr = FormatDateTime(Now(),0)
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
cmd.CommandText = "INSERT INTO tblStamp(candidateName,candidateID,candidateTel,candidateEmail,voteTime,stampCode1,stampCode2,stampCode3,stampNum1,stampNum2,stampNum3) VALUES(?,?,?,?,?,?,?,?,?,?,?)"
cmd.CommandType = adCmdText
cmd.Parameters.Append cmd.CreateParameter("@name",adVarWChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@pid",adVarChar,adParamInput,5,0)
cmd.Parameters.Append cmd.CreateParameter("@tel",adVarChar,adParamInput,8,0)
'cmd.Parameters.Append cmd.CreateParameter("@tel",adNumeric,adParamInput,8,0)
cmd.Parameters.Append cmd.CreateParameter("@email",adVarChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@time",adVarChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@code1",adVarChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@code2",adVarChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@code3",adVarChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@num1",adVarChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@num2",adVarChar,adParamInput,100,0)
cmd.Parameters.Append cmd.CreateParameter("@num3",adVarChar,adParamInput,100,0)
cmd.Parameters("@name") = Trim(Request.Form("name"))
cmd.Parameters("@pid") = Trim(Request.Form("pid"))
cmd.Parameters("@tel") = Trim(Request.Form("tel"))
cmd.Parameters("@email") = Trim(Request.Form("email"))
cmd.Parameters("@time") = dateStr
cmd.Parameters("@code1") = Trim(Request.Form("code1"))
cmd.Parameters("@code2") = Trim(Request.Form("code2"))
cmd.Parameters("@code3") = Trim(Request.Form("code3"))
cmd.Parameters("@num1") = Trim(Request.Form("num1"))
cmd.Parameters("@num2") = Trim(Request.Form("num2"))
cmd.Parameters("@num3") = Trim(Request.Form("num3"))
cmd.Execute
'strSQL="INSERT INTO tblVotedInfo(candidateName,candidateID,email,tel) VALUES('"& Request.Form("name") &"','"& Request.Form("pid") &"','"& Request.Form("tel") &"','"& Request.Form("email") &"')"
'conn.Execute strSQL,ra
'Response.Write("<br /><br /><br /><br /><center>Thank you for your vote!</center><br /><center>Your votes have been recorded successfully.</center>")

'Display record from database
'set rs=Server.CreateObject("ADODB.recordset")
'strSQL="select * from tblVotedInfo"
'rs.Open strSQL,conn
'do until rs.EOF
    'for each x in rs.Fields
        'Response.Write(x.value & "<br />")
    'next
    'rs.MoveNext
'loop
'rs.Close

'Disconnect database
conn.Close

sub validate()

end sub
 %>
</body>
</html>
